package 图书系统.user.operation;

import 图书系统.user.book.Book;
import 图书系统.user.book.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        //增加图书
        System.out.println("<增加书籍>");
        //初始化属性
        Scanner scanner=new Scanner(System.in);
        System.out.println("输入书名");
        String name=scanner.nextLine();
        System.out.println("输入作者");
        String author=scanner.nextLine();
        System.out.println("输入类型");
        String type=scanner.nextLine();
        System.out.println("输入价格");
        double price=scanner.nextDouble();
        Book book=new Book(name,author,price,type);
        bookList.setArr(bookList.getCount(),book);
        //书本加1
        bookList.setCount(bookList.getCount()+1);
        System.out.println("添加成功！");
    }
}